<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>企业综合管理运营系统平台</title>
	<link rel="stylesheet" type="text/css" href="css/admin_style.css" />
	<link rel="stylesheet" href="css/css.css" type="text/css"></link>
	<script src="js/jquery-1.4.4.min.js"></script>
	<script src="js/iframe.js"></script>
	<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="js/bdMap.js"></script>
	
	<script type="text/javascript" src="js/drag.js"></script>
	<script type="text/javascript" src="js/industry_arr.js"></script>
	<script type="text/javascript" src="js/industry_func.js"></script>
	<script>
	var msg="${msg}";
		if(msg!=""){
			alert(msg);
		}
	
	function shom(cname,addr,tel){
		ShowMap("map",{addr:addr,title:cname,lawfirm:cname,tel:tel,ismove:'0'});
	}
	function setMap(v){
		shom("",v,"");
	}
	
	// 是否在数组内
	function in_array(needle, haystack) {
		if(typeof needle == 'string' || typeof needle == 'number') {
			for(var i in haystack) {
				if(haystack[i] == needle) {
						return true;
				}
			}
		}
		return false;
	}
	</script>
	
</head>
<body class="right_body">
<form action="cus!${id>0?"update":"add" }" method="post">
	<input type="hidden" name="cus.cusid" value="${cus.cusid==null?0:cus.cusid }" />
	<div class="body">
		<div class="top_subnav">企业综合管理运营系统平台 ＞ 客户信息编辑</div>
		<div class="title">
			<div class="title_info zs">
				客户资料录入
			</div>
		</div>
		<div>
			<div class="item">
				<span>客户名称：</span><input type="text" name="cus.cusname" value="${cus.cusname }" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>类型：</span>
				<s:radio list="{'企业','个人'}" name="cus.custype" value="cus.custype"></s:radio>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>法人代表：</span><input type="text" name="cus.legal" value="${cus.legal }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>所属行业：</span>
				<input id="IndustryID_2" type="text" name="cus.industry" value="${cus.industry }" onclick="IndustrySelect_2()" readonly="readonly" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>联系地址：</span><input type="text" name="cus.address" value="${cus.address }" onchange="setMap(this.value);" size="50" />
				<div id="map" style="height:400px;width:600px;border:1px solid #bcbcbc;margin-top:5px;margin-left:50px;"></div>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>邮政编码：</span><input type="text" name="cus.zip" value="${cus.zip }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>联系电话：</span><input type="text" name="cus.tel" value="${cus.tel }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>传真：</span><input type="text" name="cus.fax" value="${cus.fax }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>客户等级：</span>
				<s:radio list="{'A级客户','B级客户','C级客户','D级客户','E级客户'}" name="cus.clevel" value="cus.clevel"></s:radio>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>客户来源：</span>
				<s:radio list="{'员工介绍','老客户介绍','广告媒体、展会','搜索引擎','EMAIL营销','博文营销'}" name="cus.rec" value="cus.rec"></s:radio>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>客户状态：</span>
				<s:radio list="{'新客户','忠实客户','流失客户'}" name="cus.state" value="cus.state"></s:radio>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>邮箱地址：</span><input type="text" name="cus.email" value="${cus.email }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>网站地址：</span><input type="text" name="cus.curl" value="${cus.curl }" size="50" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>登记时间：</span><input type="text" name="cus.joindate" value="${cus.joindate }" onclick="WdatePicker();" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>最近联系时间：</span><input type="text" name="cus.linktime" value="${cus.linktime }" onclick="WdatePicker();" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>所属人员：</span><input type="text" value="${param.id>0?cus.empid.empname:user.empname }" readonly="readonly" />
				<input type="hidden" name="cus.empid.empid" value="${param.id>0?cus.empid.empid:user.empid }" />
			</div>
			<p class="line">
			</p>
			<div class="item">
				<span>备注：</span><textarea name="cus.cdesc" rows="6" cols="60">${cus.cdesc }</textarea>
			</div>
			<p class="line">
			</p>
			<div class="item">
				<input type="submit" class="button" value=""/>
			</div>
		</div>
		<div style="clear:both"></div>
			<p class="line">
			</p>
	</div>
</form>

<script>

	//先获取ID值，判断是否大于0，大于0则表示修改，设置当前地址的位置为要修改客户的位置
	var ids="${cus.cusid }";
	if(ids!=""){
		var cname="${cus.cusname }";
		var addr="${cus.address}";
		var tel="${cus.tel}";
		shom(cname,addr,tel);
	}else{
		getBDAddress(setMap);//地图显示当前IP地址所在的位置
	}
	
</script>
<!-- alpha div -->
<div id="maskLayer" style="display:none">
<iframe id="maskLayer_iframe" frameBorder=0 scrolling=no style="filter:alpha(opacity=50)"></iframe>
<div id="alphadiv" style="filter:alpha(opacity=50);-moz-opacity:0.5;opacity:0.5"></div>
	<div id="drag">
		<h3 id="drag_h"></h3>
		<div id="drag_con"></div><!-- drag_con end -->
	</div>
</div><!-- maskLayer end -->
</div>
<!-- alpha div end -->
<div id="sublist" style="display:none"></div>

</body>
</html>
